package com.iotechn.unimall.data.dto.excel;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import lombok.Data;

import java.io.Serializable;
import java.text.DecimalFormat;

/**
 * 门店商品统计
 *
 * @author kyms
 * @date 2020-06-28 18:13
 */
@ExcelTarget("storeTotalSummaryDTO")
@Data
public class StoreSkuTotalSummaryDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    @Excel(name = "条码", width = 15d)
    private String barCode;
    @Excel(name = "商品名称", width = 15d)
    private String spuTitle;
    @Excel(name = "规格", width = 15d)
    private String skuTitle;
    @Excel(name = "单位")
    private String unit;
    @ExcelEntity(name = "期初库存")
    private SkuTotalPriceDTO startStock = new SkuTotalPriceDTO();
    @ExcelEntity(name = "入库")
    private SkuTotalPriceDTO purchaseStock = new SkuTotalPriceDTO();

    @ExcelEntity(name = "线上销售")
    private SkuTotalPriceDTO onlineStock = new SkuTotalPriceDTO();
    @ExcelEntity(name = "门店销售")
    private SkuTotalPriceDTO offlineStock = new SkuTotalPriceDTO();

    //@ExcelEntity(name = "出库")
    private SkuTotalPriceDTO salesSendStock = new SkuTotalPriceDTO();

    @ExcelEntity(name = "报损")
    private SkuUnitPriceDTO commonLossStock = new SkuUnitPriceDTO();

    @ExcelEntity(name = "品鉴")
    private SkuUnitPriceDTO tasteLossStock = new SkuUnitPriceDTO();


    @ExcelEntity(name = "调入")
    private SkuUnitPriceDTO allotInStock = new SkuUnitPriceDTO();


    @ExcelEntity(name = "调出")
    private SkuUnitPriceDTO allotOutStock = new SkuUnitPriceDTO();


    @ExcelEntity(name = "退库")
    private SkuUnitPriceDTO returnStock = new SkuUnitPriceDTO();


    // @ExcelEntity(name = "退供应商")
    private SkuUnitPriceDTO returnSupplierStock = new SkuUnitPriceDTO();


    @ExcelEntity(name = "盘盈")
    private SkuUnitPriceDTO checkAddStock = new SkuUnitPriceDTO();


    @ExcelEntity(name = "盘亏")
    private SkuUnitPriceDTO checkSubStock = new SkuUnitPriceDTO();

    @ExcelEntity(name = "期末库存")
    private SkuTotalPriceDTO endStock = new SkuTotalPriceDTO();


    //    @Excel(name = "期初库存")
    // private Float startStock;

    // @Excel(name = "目前库存", isColumnHidden = false)
    private Float stock;
    //@Excel(name = "线上销售")
    private Float onlineNum;
    //    @Excel(name = "线上退款")
    private Float onlineRefundNum;
    //  @Excel(name = "门店销售")
    private Float offlineNum;
    //    @Excel(name = "门店退款")
    private Float offlineRefundNum;
    // @Excel(name = "入库", isColumnHidden = false)
    private Float inNum;
    //  @Excel(name = "入库单价")
    private Float inPrice;
    //   @Excel(name = "入库总额")
    private Float inTotalPrice;

    //  @Excel(name = "报损", isColumnHidden = false)
    private Float lossNum;

    //  @Excel(name = "调入", isColumnHidden = false)
    private Float allotInNum;
    //  @Excel(name = "调出", isColumnHidden = false)
    private Float allotOutNum;

    private Float stockCheckNum;

    //   @Excel(name = "盘盈数量")
    private Float stockCheckAddNum;

    //    @Excel(name = "盘盈金额")
    private Float stockCheckAddPrice;

    // @Excel(name = "盘亏数量")
    private Float stockCheckSubNum;
    //  @Excel(name = "盘亏金额")
    private Float stockCheckSubPrice;

    //     @Excel(name = "退库", isColumnHidden = false)
    private Float returnNum;
    private String time;


    private Long storeId;
    private Long skuId;
    private String storeName;
    //门店计算的库存
    private Float storeStock;

    public Float getInTotalPrice() {
        if (this.inNum == null || this.inPrice == null) {
            return 0F;
        }
        DecimalFormat decimalFormat = new DecimalFormat(".00");
        String total = decimalFormat.format(this.inPrice * this.inNum);
        return Float.valueOf(total);
    }
//
//    public Float getStockCheckAddPrice() {
//        if (this.inPrice == null || this.stockCheckAddNum == null || this.stockCheckAddNum.equals(0)) {
//            return 0F;
//        }
//        DecimalFormat decimalFormat = new DecimalFormat(".00");
//        String total = decimalFormat.format(this.inPrice * this.stockCheckAddNum);
//        return Float.valueOf(total);
//    }
//
//    public Float getStockCheckSubPrice() {
//        if (this.inPrice == null || this.stockCheckSubNum == null || this.getStockCheckSubNum().equals(0)) {
//            return 0F;
//        }
//        DecimalFormat decimalFormat = new DecimalFormat(".00");
//        String total = decimalFormat.format(this.inPrice * this.getStockCheckSubNum());
//        return Float.valueOf(total);
//    }
//
//    public Float getStoreStock() {
//        Float storeStock = inNum - onlineNum - offlineNum + lossNum + allotInNum + allotOutNum + stockCheckAddNum + stockCheckSubNum - returnNum;
//        DecimalFormat decimalFormat = new DecimalFormat(".00");
//        String total = decimalFormat.format(storeStock);
//        return Float.valueOf(total);
//    }
}
